﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ExternalEngineWrapper.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Allows 3rd Party script engines to supply Do and Undo scripts.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Collaboris.Saf.Actions.Entities
{
    using System;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [Serializable]
    [CollaborisClass(
    Title = "External Engine Wrapper",
    ReleaseStatus = ReleaseStatus.Stable,
    DisableDocumentation = false,
    ContactAuthorEmail = "Support@Collaboris.co.uk",
    Summary = "This class supports the ability to add one script for 'Do' and one script for 'Undo'.",
    Remarks = "Use this class when writing an action (that wraps a 3rd party engine) that doesn't natively support 'Do' or 'Undo'.<br/>" +
              "For example, if you wish to run a Shell command from SAF and supply commands for Undo and Do, you would use this Wrapper."
  )]
    public class ExternalEngineWrapper<T> : EntityBase // where T : ExternalEngine
    {
        private T doScript;

        private T undoScript;

        [CollaborisProperty(
         Summary = "Optional. A generic type of T that will be executed during an Undo. ",
         Title = "Undo Script",
         Remarks = "Please refer to the SQLScript, STSAdm or Powershell actions for examples." + 
                    "<br/>Only supply a value if you want the 3rd party script to be run on the 'Undo', otherwise do not set.",
         Example = ""
         )]
        public T UndoScript
        {
            get
            {
                return undoScript;
            }
            set
            {
                undoScript = value;
            }
        }

        [CollaborisProperty(
         Summary = "Optional. A generic type of T that will be executed during a Do. ",
         Title = "Do Script",
         Remarks = "Please refer to the SQLScript, STSAdm or Powershell actions for examples." +
         "<br/>Only supply a value if you want the 3rd party script to be run on the 'Do', otherwise do not set.",
         Example = ""
         )]
        public T DoScript
        {
            get
            {
                return this.doScript;
            }
            set
            {
                this.doScript = value;
            }
        }
    }
}
